package name.as3.cmdFrameworks.core
{
import flash.utils.SafeGlobalOwner;
import flash.utils.SafeGlobalProxy;

import name.as3.cmdFrameworks.interfaces.IFacade;
import name.as3.cmdFrameworks.interfaces.INotification;

public class Notification extends SafeGlobalOwner implements INotification
{
	private var m_obData:*;
	private var m_strType:String;
	private var m_facade:IFacade;
	/**
	 *
	 */
	public function Notification(strType:String, obData:* = null)
	{
		this.type = strType;
		this.data = obData;
	}
//==================================================================================================
// public
//==================================================================================================
	/**
	 * 执行数据
	 */
	public function dispatch():void
	{
		if (m_facade != null)
		{
			m_facade.executeCommand(this);
		}
		else
		{
			throw new Error("Need Facade! ");
		}
	}
//==================================================================================================
// public interface
//==================================================================================================
	/**
	 * 设置表面
	 */
	public function setFacade(value:IFacade, proxyGlobal:SafeGlobalProxy):void
	{
		m_facade = value;
		super.sg = proxyGlobal;
	}
	/**
	 * 获取表面
	 */
	public function get facade():IFacade
	{
		return null;
	}
	/**
	 * 设置数据
	 */
	public function set data(value:*):void
	{
		m_obData = value;
	}
	/**
	 * 获取数据
	 */
	public function get data():*
	{
		return m_obData;
	}
	/**
	 * 设置类型
	 */
	public function set type(value:String):void
	{
		m_strType = value;
	}
	/**
	 * 获取类型
	 */
	public function get type():String
	{
		return m_strType;
	}
}
}